<template>
  <!--通用仓库详情对话框-->
    <div>
      <el-dialog
        title="仓库详情数据"
        :visible.sync="Visible"
        width="70%">
        <el-table :data="warehouseDetailsInfoList">
          <el-table-column prop="shopInfo.shopName" label="商品名称"></el-table-column>
          <el-table-column prop="shopInfo.type.name" label="商品分类"></el-table-column>
          <el-table-column prop="users.uname" label="供应商"></el-table-column>
          <el-table-column prop="maxNum" label="最大存储值"></el-table-column>
          <el-table-column prop="minNum" label="最小存储值"></el-table-column>
          <el-table-column prop="amount" label="当前存储量"></el-table-column>
          <el-table-column prop="lockStock" label="锁定库存"></el-table-column>
        </el-table>
        <div>
          <!-- 分页 -->
          <el-pagination
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
            :current-page="pageno"
            :page-sizes="[5, 10, 15, 20]"
            :page-size="pagesize"
            layout="total, sizes, prev, pager, next, jumper"
            :total="total"
          >
          </el-pagination>
        </div>
        <div slot="footer" class="dialog-footer">
          <el-button @click="Visible = false">退 出</el-button>
        </div>
      </el-dialog>
    </div>
</template>

<script>
    export default {
        name: "WarehouseDetailsInfo_dialog",
        data(){
          return{
            Visible:false,
            warehouseDetailsInfoList:[],
            pageno: 1,
            pagesize: 5,
            total: 1
          }
        },
        methods:{
          open(){
            this.Visible=true;
          },
          getData(id){
            let warehouseDetailsInfo={
              pId:id,//设置父仓库id
              isCheck:1//通过审核
            };
            console.log(warehouseDetailsInfo);
            //调用异步，根据父仓库id，查询仓库详情数据
            let params=new URLSearchParams();
            params.append("pageno", this.pageno);
            params.append("pagesize", this.pagesize);
            Object.keys(warehouseDetailsInfo).forEach(item=>{
              params.append(item,warehouseDetailsInfo[item]);
            })
            //异步，根据父仓库id查询通过审核的仓库详情
            this.$axios.get("warehouseDetailsInfo/warehouseDetailsInfo.action",{params:warehouseDetailsInfo}).
            then((response)=> {   //异步调用成功执行
              //将查询到的数据存入对象数组中
              this.warehouseDetailsInfoList=response.data.records;
              this.total = response.data.total;
            }).catch(function (error) {//异步调用失败执行
              alert(error);
            });
          },
          change(id){
            alert(id);
          },
          handleSizeChange(val) {
            //每页范围
            this.pagesize = val;
            this.getShopData();
          },
          handleCurrentChange(val) {
            //当前页
            this.pageno = val;
            this.getShopData();
          }
        }
    }
</script>

<style scoped>

</style>
